//
//  MSTradeSuccessCell.m
//  SocietySale
//
//  Created by Mike on 16/11/15.
//  Copyright © 2016年 Mike. All rights reserved.
//

#import "MSTradeSuccessCell.h"

@interface MSTradeSuccessCell ()
@property(nonatomic,strong)UILabel *keyLabel;
@property(nonatomic,strong)UILabel *valueLabel;
@end

@implementation MSTradeSuccessCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.keyLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 5, 50, 20)];
        self.keyLabel.font = HeitiFont(14);
        self.keyLabel.textColor = kDarkGrayColor;
        //        self.keyLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:self.keyLabel];
        
        self.valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.keyLabel.right, 5, SCREEN_WIDTH-70, 20)];
        self.valueLabel.font = HeitiFont(14);
        self.valueLabel.numberOfLines = 0;
        self.valueLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:self.valueLabel];
    }
    return self;
}

- (void)setData:(DOKeyValue *)value
{
    _data = [value copy];
    self.keyLabel.text = _data.key;
    self.valueLabel.text = _data.value;
    
    CGSize typeSize = [HDUtil sizeWithString:_data.value font:HeitiFont(14) size:CGSizeMake(SCREEN_WIDTH-70, CGFLOAT_MAX)];
    if (typeSize.height>24) {
        self.valueLabel.height = 40;
    }
    else{
        self.valueLabel.height = 20;
    }
//    if ([_data.key containsString:@"电话"]) {
//        self.valueLabel.textColor = kBlueColor;
//    }
//    else{
//        self.valueLabel.textColor = [UIColor blackColor];
//    }
}

+ (CGFloat)cellHeightWithModel:(DOKeyValue *)value{
    CGSize typeSize = [HDUtil sizeWithString:value.value font:HeitiFont(14) size:CGSizeMake(SCREEN_WIDTH-70, CGFLOAT_MAX)];
    if (typeSize.height>24) {
        return 50;
    }
    return 30;
}

@end
